//
//  WCQuestionListCell.m
//  WC
//
//  Created by wsj2015 on 16/1/26.
//  Copyright © 2016年 ShanghaiCize Trade And Business Co., Ltd. All rights reserved.
//

#import "WCQuestionListCell.h"

@interface WCQuestionListCell  ()
@property (nonatomic,  retain) NSArray *typeTitleArray;


@end


@implementation WCQuestionListCell

- (void)awakeFromNib {
    // Initialization code
    
    self.selectImage.hidden = YES;
//    self.iconView.layer.cornerRadius = 32;
//    self.iconView.layer.masksToBounds = YES;
    self.checkbtn.layer.masksToBounds =YES;
    self.checkbtn.layer.cornerRadius =5;
    
}
- (NSArray *)typeTitleArray{
    if (_typeTitleArray ==nil) {
//        1伤口，2PICC，3妇幼，4慢性，5其他
        _typeTitleArray =@[@"伤口",@"PICC",@"妇幼",@"慢性",@"其他"];
    }
    return _typeTitleArray;

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


-(void)setModel:(WCQestionnaireModel *)model{
    _model = model;
    self.titleLabel.text = model.name;
    NSString *imageName;
    NSInteger index= [model.type integerValue]-1;
    //问卷提交 不能反馈
    if ([model.isOver integerValue] ==0) {
        [self.checkbtn setBackgroundColor:[UIColor grayColor]];
        self.checkbtn.enabled = NO;
    }
    
    if (index>=0 &&index <4) {
        imageName =[NSString stringWithFormat:@"%@问卷",self.typeTitleArray[index]];
    }else{
        imageName =[NSString stringWithFormat:@"%@问卷",self.typeTitleArray[4]];
        
    }
    if (model.feedback) {
        [self.checkbtn setTitle:@"查看反馈" forState:UIControlStateNormal];
    }else{
         [self.checkbtn setTitle:@"反馈" forState:UIControlStateNormal];
    }
    
    
    self.iconView.image=[UIImage imageNamed:imageName];
    self.selectImage.image = model.isSelect?[UIImage imageNamed:@"Mult_Select"]:[UIImage imageNamed:@"Selected_no"];
    
 
}

- (IBAction)checkAction:(id)sender {
    if (self.chekAction) {
        self.chekAction();
    }
}
- (void)setCellTypeForSelect:(BOOL)cellTypeForSelect{
    _cellTypeForSelect = cellTypeForSelect;
    
    self.checkbtn.hidden = cellTypeForSelect;
    self.selectImage.hidden =!cellTypeForSelect;
    

}

@end
